<?php include_once './application/views/sys_admin/common/header.php';  ?>
<div id="dialog" title="用户信息" style="display:none"> <div id="view_response"></div> </div>
<div id="dialog2" title="系统提示" style="display:none"><p id="msg" style="text-align:center"></p></div>
<div class=" definewidth m20">
		<form  class="form-inline definewidth m20" action="" method="get" id="form0" name="form0">
  			用户名：<input type="text" id="username" name="username" value="<?php echo $parms['username'];?>" />
  			Email：<input type="text" id="email" name="email" value="<?php echo $parms['email'];?>" />
  			真实姓名：<input type="text" id="realname" name="realname" value="<?php echo $parms['realname'];?>" />
  			注册时间：<input type="text" id="add_time" name="add_time" style="width: 100px;" value="<?php echo $add_time;?>"  onfocus="WdatePicker()"  class="Wdate" />
  			<button type="button" class="btn btn-success"  onclick="this.form.submit();" >查询</button>
  		</form>
		<table class="table table-bordered table-hover definewidth m10">
			 <thead>
			    <tr>
			        <th><strong>ID</strong></th>
					<th><strong>会员名</strong></th>
					<th><strong>会员等级</strong></th>
					<th><strong>累计充值金额</strong></th>
					<th><strong>累计投标数量</strong></th>
					<th><strong>累计投标金额</strong></th>
					<th><strong>账户余额</strong></th>
					<th><strong>邮箱</strong></th> 
					<th><strong>手机</strong></th>
					<th><strong>介绍人</strong></th>
					<th><strong>注册时间</strong></th>
					<th><strong>锁定时间</strong></th>
					<th><strong>状态</strong></th>
					<th><strong>操作</strong></th>
			    </tr>
			   </thead>
			 <?php foreach($user_list as $info){?>
			 <tr id="row_<?php echo $info['user_id'];?>">
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $info['user_id'];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><a href="javascript:showUser(<?php echo $info['user_id'];?>);"><?php echo $info['username'];?></a></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF">
					<img title="会员积分：<?php echo $info['credit_value'];?>分" alt="会员积分：<?php echo $info['credit_value'];?>分" src="/static/credit/<?php echo $info['pic'];?>">
			 	</td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo number_format($info['recharge_money'],2);?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo number_format($info['tender_count'],2);?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo number_format($info['tender_money'],2);?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo number_format($info['use_money'],2);?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $info['email'];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $info['phone'];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $info['invite_uname'];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo date('Y-m-d H:i',$info['add_time']);?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo date('Y-m-d H:i',$info['lasttime']);?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $userFstatus[$info['fstatus']];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF">
				<a href="javascript:if(confirm('确定解除锁定？')){remove(<?php echo $info['user_id'];?>);}">解除锁定</a>
				</td>
			  </tr>
			  <?php }?>
			  	<tr>
			  	<td colspan="14"  class="page"><?php echo $this->pagination->create_links();?></td>
			  	</tr>
		</table>
</div>

<script>
function showUser(user_id){
	$.ajax({
		type: "POST",
		url: "/sys_admin/user/showDetailInfo",
		data: "user_id="+user_id,
		success: function(ret){
				$('#dialog').dialog({
					width:650,
					height:600,
					title:'用户信息',
					buttons:{"确定":function(){$(this).dialog("close");}},
				}); 
				$("#view_response").html(ret);			
		},
		dataType: "text"
	});
	
}

//解除锁定确认
function remove(id){
	$.ajax({
		type: "post",
		url: "/sys_admin/user/remove/",
		data: "user_id="+id,
		success: function(msg){
			
			$("#dialog2" ).dialog();
			if(msg == 1){
				$("#msg").html("解除锁定成功！");
				$("#row_"+id).hide();
			}else{
				
				$("#msg").html("解除锁定失败，请联系超级管理员！");
			}
			setTimeout(function(){
				$("#dialog2" ).dialog("close");
			},3000);
		},
		dataType: "text"
	});
}

</script>

